package util;

import javafx.util.Pair;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @author xushenbao
 * @desc 添加描述
 * @create 2020/11/10
 */
public interface SomeFunction {
    static <A,B> List<Pair<A,B>> zip(List<A> aList,List<B> bList ) {
       if(aList.size()!=bList.size()) {
           throw new RuntimeException(String.format("两个列表的大小必须相等,aList size:%s,bList size:%s", aList,bList));
       }
       return IntStream.range(0,aList.size()).mapToObj(i->new Pair<>(aList.get(i),bList.get(i))).collect(Collectors.toList());
    }
}
